{extend name="layout" /}
{block name="content"}
<div class="row">
  <div class="col-xs-3">
    <form id="searchForm">
    <div class="input-group input-group-sm">
        <input type="text" class="form-control input-sm" name="keywords">
        <span class="input-group-btn">
          <button type="button" class="btn btn-info btn-flat searchBtn" pageid="pages">搜  索</button>
        </span>
    </div>
    <input type="hidden" name="fieldset" value="keywords-name|title-like">
    </form>
  </div>
  <div class="col-xs-9" style="text-align: right">
    <button type="button" class="btn btn-success btn-sm cocoModal" isForm url="{:url('add')}" title="新增项目" fixat="1"><i class="fa fa-plus"></i> 新增</button>
    <button type="button" class="btn btn-danger btn-sm cocoAjax" confirm="确定要删除吗？" checkItem="1:0" ajaxUrl="{:url('data_delete')}"><i class="fa fa-remove"></i> 批量删除</button>
    <button type="button" class="btn btn-info btn-sm export" title="线索列表"><i class="fa fa-edit"></i> 数据导出</button>
  </div>
</div>
  
<table class="layui-table" lay-data="{height: 'full-75', cellMinWidth: 80, page: true, limit:30, url:'{:url('data_show')}'}" lay-filter="lists">
  <thead>
    <tr class="layui-colla-content">
      <th lay-data="{type:'checkbox'}">ID</th>
      <th lay-data="{field:'id', sort: true, fixed: 'right', width:80, align:'center'}">UID</th>
      <th lay-data="{field:'realname'}">姓名</th>
      <th lay-data="{field:'dealer'}">所属经销商</th>
      <th lay-data="{field:'ordersn'}">订单编号</th>
      <th lay-data="{field:'convertname'}">商品名称</th>
      <th lay-data="{field:'nums'}">兑换数量</th>
      <th lay-data="{field:'totalprice'}">总价格</th>
      <th lay-data="{field:'name'}">收货人</th>
      <th lay-data="{field:'phone'}">联系电话</th>
      <th lay-data="{field:'address'}">收货地址</th>
      <th lay-data="{field:'expressno'}">运单编号</th>
      <th lay-data="{field:'statusname'}">状态</th>
      <th lay-data="{fixed: 'right', width:120, align:'center', toolbar: '#barDemo'}">操作</th>
  </thead>
</table>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="send_convert">发货</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
</script>
{/block}
{block name="script"}
<script type="text/javascript">
  function send_convert(data) {
    var layindex = layer.open({
      type: 2,
      area: ['800px', '600px'],
      fixed: false, //不固定
      maxmin: true,
      content: APP_URL+"/admin/orderconvert/adddesc?id="+data.id,
      title:'发货',
      btn: ['确定', '取消'],
      shade: [0.8, '#000000'],
      yes:function(index,layero){
        //parent.$('#parentIframe').text('我被改变了');
        var iframeWin = window[layero.find('iframe')[0]['name']];
        formobj = iframeWin.$("form");
        ajaxUrl = formobj.attr("action");
        if(ajaxUrl == undefined || ajaxUrl == ''){
          ajaxUrl = defaultSaveUrl;
        }
        datajson = formobj.serialize();
        searchMap.postData = datajson;
        console.log(datajson);
        $.post(ajaxUrl,searchMap,function(datajson){
          var serializeObj={};
          if(datajson.status == 1){
            $(formobj.serializeArray()).each(function(){  
              serializeObj[this.name]=this.value;  
            });  
            layer.msg("操作成功",function(){
              layer.closeAll();
            });
            setTimeout(function() {
              location.reload();
            }, 300);
          }
          else{
            layer.msg(datajson.msg);
            return false;
          }
        },'json');
      }
    });
  }
</script>
{/block}